package com.example.idachuappone.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class PrefUtil {
	private static PrefUtil spInstance;
	private SharedPreferences userConfig;

	public static synchronized PrefUtil getInstance(Context context) {
		PrefUtil prefUtil;
		synchronized (PrefUtil.class) {
			if (spInstance == null) {
				spInstance = new PrefUtil(context);
			}
			prefUtil = spInstance;
		}
		return prefUtil;
	}

	private PrefUtil(Context context) {
		init(context);
	}

	private void init(Context context) {
		this.userConfig = context.getSharedPreferences("lovechef_config", 0);
	}

	public int getVersion() {
		return this.userConfig.getInt("version", 0);
	}

	public void setVersion(int version) {
		this.userConfig.edit().putInt("version", version).commit();
	}

	public boolean getFrist() {
		return this.userConfig.getBoolean("frist", true);
	}

	public void setFrist(boolean frist) {
		this.userConfig.edit().putBoolean("frist", frist).commit();
	}

	public String getUID() {
		return this.userConfig.getString("uid", null);
	}

	public void setUID(String userId) {
		this.userConfig.edit().putString("uid", userId).commit();
	}

	public String getAuth() {
		return this.userConfig.getString("auth", null);
	}

	public void setAuth(String auth) {
		this.userConfig.edit().putString("auth", auth).commit();
	}

	public void setLocateTime(long locTime) {
		this.userConfig.edit().putLong("lastTime", locTime).commit();
	}

	public long getLocateTime() {
		return this.userConfig.getLong("lastTime", 0);
	}

	public void setLocateCoor(String locCoor) {
		this.userConfig.edit().putString("lastCoor", locCoor).commit();
	}

	public String getFimallyLocateCoor() {
		return this.userConfig.getString("fimally", "");
	}

	public void setFimallyLocateCoor(String locCoor) {
		this.userConfig.edit().putString("fimally", locCoor).commit();
	}

	public String getLocateCoor() {
		return this.userConfig.getString("lastCoor", "");
	}

	public void setUserAddressId(String id) {
		this.userConfig.edit().putString("useraddressid", id).commit();
	}

	public String getUserAddressId() {
		return this.userConfig.getString("useraddressid", null);
	}

	public void setName(String name) {
		this.userConfig.edit().putString("name", name).commit();
	}

	public String getName() {
		return this.userConfig.getString("name", "");
	}

	public void setPhone(String phone) {
		this.userConfig.edit().putString("phone", phone).commit();
	}

	public String getPhone() {
		return this.userConfig.getString("phone", "");
	}

	public void setLoginPhone(String loginphone) {
		this.userConfig.edit().putString("loginphone", loginphone).commit();
	}

	public String getLoginPhone() {
		return this.userConfig.getString("loginphone", "");
	}

	public void setArea(String area) {
		this.userConfig.edit().putString("area", area).commit();
	}

	public String getArea() {
		return this.userConfig.getString("area", "");
	}

	public void setDoor(String door) {
		this.userConfig.edit().putString("door", door).commit();
	}

	public String getDoor() {
		return this.userConfig.getString("door", "");
	}

	public void setXiaoQu(String xiaoqu) {
		this.userConfig.edit().putString("xiaoqu", xiaoqu).commit();
	}

	public String getXiaoQu() {
		return this.userConfig.getString("xiaoqu", "");
	}

	public void setMa(String youhuima) {
		this.userConfig.edit().putString("youhuima", youhuima).commit();
	}

	public String getMa() {
		return this.userConfig.getString("youhuima", "");
	}

	public void setYOUHuiPan(int youhuipan) {
		this.userConfig.edit().putInt("youhuipan", youhuipan).commit();
	}

	public int getYOUHuiPan() {
		return this.userConfig.getInt("youhuipan", 0);
	}

	public void setPersonImgBanner(int youhuipan) {
		this.userConfig.edit().putInt("personimgbanner", youhuipan).commit();
	}

	public int getPersonImgBanner() {
		return this.userConfig.getInt("personimgbanner", 0);
	}

	public void setMainVersion(int mainversion) {
		this.userConfig.edit().putInt("mainversion", mainversion).commit();
	}

	public int getMainVersion() {
		return this.userConfig.getInt("mainversion", 0);
	}

	public void setIsAddressIndexDialog(boolean isaddressindexdialog) {
		this.userConfig.edit().putBoolean("isaddressindexdialog", isaddressindexdialog).commit();
	}

	public boolean getIsAddressIndexDialog() {
		return this.userConfig.getBoolean("isaddressindexdialog", false);
	}

	public void setYouhuiPersonDianId(String youhuipersondianid) {
		this.userConfig.edit().putString("youhuipersondianid", youhuipersondianid).commit();
	}

	public String getYouhuiPersonDianId() {
		return this.userConfig.getString("youhuipersondianid", "0");
	}
}
